﻿using System;
using System.Collections.Generic;
using DevelopmentKit.Enums;
using SharpArch.Domain.DomainModel;
using System.ComponentModel.DataAnnotations;

namespace DevelopmentKit.Domain
{
    /// <summary>
    /// 用户
    /// </summary>
    public class User : Entity
    {
        /// <summary>
        /// 登录名  登录名唯一
        /// </summary> 

        [Display(Name = "登录名")]
        [Required(ErrorMessage = "{0}不能为空")]
        [StringLength(32, ErrorMessage = "{0}取值长度{1}~{2}个字符", MinimumLength = 0)]
        public virtual string UserName{get;set;}
        /// <summary>
        /// 姓名
        /// </summary>
        [Display(Name = "姓名")]
        [Required(ErrorMessage = "{0}不能为空")]
        [StringLength(32, ErrorMessage = "{0}取值长度{1}~{2}个字符", MinimumLength = 0)]
        public virtual string Name{get;set;}
        /// <summary>
        /// 密码
        /// </summary>
        [Display(Name = "密码")]
        [Required(ErrorMessage = "{0}不能为空")]
        [StringLength(225, ErrorMessage = "{0}取值长度{1}~{2}个字符", MinimumLength = 0)]
        public virtual string Password{get;set;}
        /// <summary>
        /// 手机号码
        /// </summary>
        [Display(Name = "手机号码")]
        [Required(ErrorMessage = "{0}不能为空")]
        [StringLength(32, ErrorMessage = "{0}取值长度{1}~{2}个字符", MinimumLength = 0)]
        public virtual string Mobile { get; set; }
        /// <summary>
        /// 邮箱
        /// </summary>
        [Display(Name = "邮箱")]
        [Required(ErrorMessage = "{0}不能为空")]
        [StringLength(32, ErrorMessage = "{0}取值长度{1}~{2}个字符", MinimumLength = 0)]
        public virtual string Email { get; set; }
        /// <summary>
        /// 性别
        /// </summary>
        [Display(Name = "性别")] 
        public virtual Sex Sex { get; set; }

        /// <summary>
        /// 用户类型
        /// </summary>
        [Display(Name = "用户类型")]
        public virtual UserType UserType { get; set; }
        /// <summary>
        /// 角色列表
        /// </summary>
        [Display(Name = "角色列表")] 
        public virtual IList<Role> Roles { get; set; }
        /// <summary>
        /// 企业
        /// </summary>
        [Display(Name = "企业")]
        [Required(ErrorMessage = "{0}不能为空")]
        public virtual Enterprise Enterprise { get; set; }
       

        /// <summary>
        /// 状态
        /// </summary>
        [Display(Name = "状态")]
        [Required(ErrorMessage = "{0}不能为空")]
        public virtual UserStatus Status { get; set; } 

        /// <summary>
        /// 创建时间
        /// </summary>
        [Display(Name = "创建时间")]
        [Required(ErrorMessage = "{0}不能为空")]
        public virtual DateTime Created { get; set; }
        /// <summary>
        /// 修改时间
        /// </summary>
        [Display(Name = "修改时间")]
        [Required(ErrorMessage = "{0}不能为空")]
        public virtual DateTime Modified { get; set; }
 
    }
}